package c.e.a.c.p;

import android.content.Context;
import android.content.res.TypedArray;
import android.util.AttributeSet;
import android.util.TypedValue;
import c.b.a.a.a;
import c.e.a.c.b;

/* compiled from: ThemeEnforcement */
public final class h {
    public static final int[] a = new int[]{2130968785};
    public static final int[] b = new int[]{2130968788};

    public static void a(Context context, AttributeSet attributeSet, int i, int i2) {
        TypedArray obtainStyledAttributes = context.obtainStyledAttributes(attributeSet, b.B, i, i2);
        boolean z = obtainStyledAttributes.getBoolean(1, false);
        obtainStyledAttributes.recycle();
        if (z) {
            TypedValue typedValue = new TypedValue();
            if (!context.getTheme().resolveAttribute(2130968999, typedValue, true) || (typedValue.type == 18 && typedValue.data == 0)) {
                c(context, b, "Theme.MaterialComponents");
            }
        }
        c(context, a, "Theme.AppCompat");
    }

    /* JADX WARNING: Missing block: B:16:0x0038, code skipped:
            if (r0.getResourceId(0, -1) != -1) goto L_0x003a;
     */
    public static void b(android.content.Context r4, android.util.AttributeSet r5, int[] r6, int r7, int r8, int... r9) {
        /*
        r0 = c.e.a.c.b.B;
        r0 = r4.obtainStyledAttributes(r5, r0, r7, r8);
        r1 = 2;
        r2 = 0;
        r1 = r0.getBoolean(r1, r2);
        if (r1 != 0) goto L_0x0012;
    L_0x000e:
        r0.recycle();
        return;
    L_0x0012:
        r1 = -1;
        if (r9 == 0) goto L_0x0034;
    L_0x0015:
        r3 = r9.length;
        if (r3 != 0) goto L_0x0019;
    L_0x0018:
        goto L_0x0034;
    L_0x0019:
        r4 = r4.obtainStyledAttributes(r5, r6, r7, r8);
        r5 = r9.length;
        r6 = 0;
    L_0x001f:
        if (r6 >= r5) goto L_0x0030;
    L_0x0021:
        r7 = r9[r6];
        r7 = r4.getResourceId(r7, r1);
        if (r7 != r1) goto L_0x002d;
    L_0x0029:
        r4.recycle();
        goto L_0x003b;
    L_0x002d:
        r6 = r6 + 1;
        goto L_0x001f;
    L_0x0030:
        r4.recycle();
        goto L_0x003a;
    L_0x0034:
        r4 = r0.getResourceId(r2, r1);
        if (r4 == r1) goto L_0x003b;
    L_0x003a:
        r2 = 1;
    L_0x003b:
        r0.recycle();
        if (r2 == 0) goto L_0x0041;
    L_0x0040:
        return;
    L_0x0041:
        r4 = new java.lang.IllegalArgumentException;
        r5 = "This component requires that you specify a valid TextAppearance attribute. Update your app theme to inherit from Theme.MaterialComponents (or a descendant).";
        r4.<init>(r5);
        throw r4;
        */
        throw new UnsupportedOperationException("Method not decompiled: c.e.a.c.p.h.b(android.content.Context, android.util.AttributeSet, int[], int, int, int[]):void");
    }

    public static void c(Context context, int[] iArr, String str) {
        TypedArray obtainStyledAttributes = context.obtainStyledAttributes(iArr);
        Object obj = null;
        for (int i = 0; i < iArr.length; i++) {
            if (!obtainStyledAttributes.hasValue(i)) {
                obtainStyledAttributes.recycle();
                break;
            }
        }
        obtainStyledAttributes.recycle();
        obj = 1;
        if (obj == null) {
            throw new IllegalArgumentException(a.E("The style on this component requires your app theme to be ", str, " (or a descendant)."));
        }
    }

    public static TypedArray d(Context context, AttributeSet attributeSet, int[] iArr, int i, int i2, int... iArr2) {
        a(context, attributeSet, i, i2);
        b(context, attributeSet, iArr, i, i2, iArr2);
        return context.obtainStyledAttributes(attributeSet, iArr, i, i2);
    }
}
